package com.dome.order.feignapi;

import com.dome.order.entity.bo.OrderEntity;
import com.dome.order.entity.dto.OrderDto;
import com.dome.order.feign.OrderClient;
import com.dome.order.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RequestMapping("/feign")
@RestController
public class OrderFeignController implements OrderClient {

    @Autowired
    private OrderService orderService;


    @Override
    public OrderDto selectById(Long id) {
        OrderEntity orderEntity=orderService.selectById(id);
        OrderDto orderDto=new OrderDto();
        BeanUtils.copyProperties(orderEntity,orderDto);
        return orderDto;
    }
}
